package org.tong.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.tong.bean.Order;
import org.tong.bean.OrderItem;
import org.tong.dao.OrderDao;
import org.tong.dao.OrderItemDao;

@Service
public class ShardingService {

    @Autowired
    private OrderDao orderDao;

    @Autowired
    private OrderItemDao orderItemDao;

    @Transactional
    public void batchInsert(Order order, OrderItem orderItem) {
        orderItemDao.insert(orderItem);
        orderDao.insert(order);

    }
}
